<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>会员注册页面</title>
<link type="text/css" rel="stylesheet" href="/static/css/style.css" >
<style type="text/css">
	.login_form{
		height:420px;
		margin-top: 25px;
	}
	
</style>
<script type="text/javascript" src="/static/script/jquery-1.7.2.js"></script>
<script>
	//function可以在页面加载完后加载执行里面的js代码
	$(function(){
	$("#msg").hide();
	if("{{.}}"=="用户名已存在！"){
		$("#msg").show();
	}

	//发送Ajax请求验证用户名是否存在
	//为输入用户名的文本框绑定事件，change就是在更改值时触发
	$("#username").change(function(){
		//获取用户输入的用户名
		var username = $(this).val();
		//设置请求的地址
		var url = "/checkUserName";
		//设置请求的参数
		var param = {"username":username};
		//发送Ajax请求，传url，参数，回调函数，res是回调的数据
		$.post(url,param,function(res){
			//把响应值放到span标签里
			$("#msg").show();
			//.text是将响应的内容以文本形式显示，.html则是会解析为html
			// $("#msg").text(res);
			$("#msg").html(res);
		});
	})


	})
	
</script>
</head>
<body>
		<div id="login_header">
			<img class="logo_img" alt="" src="/static/img/logo.gif" >
		</div>
		
			<div class="login_banner">
			
				<div id="l_content">
					<span class="login_word">欢迎注册</span>
				</div>
				
				<div id="content">
					<div class="login_form">
						<div class="login_box">
							<div class="tit">
								<h1>注册会员</h1>
								<span class="errorMsg" id="msg">{{.}}</span>
							</div>
							<br>
							<div class="form">
								<form action="/regist" method="POST">
									<label>用户名称：</label>
									<input class="itxt" type="text" placeholder="请输入用户名" autocomplete="off" tabindex="1" name="username" id="username" />
									<br />
									<br />
									<label>用户密码：</label>
									<input class="itxt" type="password" placeholder="请输入密码" autocomplete="off" tabindex="1" name="password" id="password" />
									<br />
									<br />
									<label>确认密码：</label>
									<input class="itxt" type="password" placeholder="确认密码" autocomplete="off" tabindex="1" name="repwd" id="repwd" />
									<br />
									<br />
									<label>电子邮件：</label>
									<input class="itxt" type="text" placeholder="请输入邮箱地址" autocomplete="off" tabindex="1" name="email" id="email" />
									<br />
									<br />
									<br />
									<input type="submit" value="注册" id="sub_btn" />
								</form>
							</div>
							
						</div>
					</div>
				</div>
			</div>
		<div id="bottom">
			<span>
				书城.Copyright &copy;2015
			</span>
		</div>
</body>
</html>